package com.example.dairenkun.neufoodshop.model;


import com.example.dairenkun.neufoodshop.bean.Food;
import com.example.dairenkun.neufoodshop.service.CollectionService;
import com.example.dairenkun.neufoodshop.service.FoodService;
import com.example.dairenkun.neufoodshop.service.LoginService;
import com.example.dairenkun.neufoodshop.service.SearchService;

import java.util.List;

import retrofit2.Call;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Administrator on 2017/5/8.
 */

public class FoodModel {
    private Retrofit retrofit;
    public FoodModel(){
        retrofit=new Retrofit.Builder()
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://60.205.189.39/")
                .build();

    }
    //食物列表
    public Call getFoodList (int shopid ){
        FoodService testService=retrofit.create(FoodService.class);
        return testService.getShopFood(shopid);
    }
    //菜单详情
    public Call FoodDetail (int foodid ){
        FoodService service = retrofit.create(FoodService.class);
        return  service.getFoodDetail(foodid);
    }
    //获取评论订单
    public Call FoodCommentList(int foodid){
        FoodService testService=retrofit.create(FoodService.class);
        return testService.getFoodComment(foodid);
    }
//判断是否收藏
    public Call isCollect(int userid,int shop_food_id,int falg){
        CollectionService service=retrofit.create(CollectionService.class);
        return  service.isCollection(userid,shop_food_id,falg);
    }
    //收藏与取消收藏dianpu
    public Call doCollect(int userid,int shop_id){
        CollectionService service=retrofit.create(CollectionService.class);
        return  service.doCollectShop(userid,shop_id);
    }
    //收藏与取消收藏dianpu
    public Call doCollectfood(int userid,int food_id){
        CollectionService service=retrofit.create(CollectionService.class);
        return  service.doCollectFood(userid,food_id);
    }
    //显示所有的收藏信息
    public Call CollectList(int userid,int flag){
        CollectionService service=retrofit.create(CollectionService.class);
        return  service.getCollectionList(userid,flag);
    }

}
